<?php
/**
 * Included version of Updates for SupportCase form
 * @package ModuleAssistance
 * @version 1.0b
 * @return table
 */

$updateList = $supportcase->GetUpdateList();
if (count($updateList) > 0):
?>
<table cellpadding="0" cellspacing="0" border="0" class="table-objects corner-all">
	<tr>
		<th class="check"></th>
		<th>Date</th>
		<th>Auteur</th>
		<th>Description</th>
	</tr>
	<?php foreach ($updateList as $update) {
		$crmuser = $update->GetCrmuser();
		$crmcontact = $crmuser->GetContact();
		$date = explode('-', substr($update->date, 0, 10));
		$date = $date[2].'/'.$date[1].'/'.$date[0].' à '.substr($update->date, 11, 5);
		
		$res  = '<tr>';
		$res .= '<td class="check"><input type="checkbox" value="'.$update->updateId.'" /></td>';
		$res .= '<td>'.$date.'</td>';
		$res .= '<td><a href="crmusers.php?id='.$crmuser->crmuserId.'&operation=edit">'.$crmcontact->lastname.' '.$crmcontact->firstname.'</a></td>';
		$res .= '<td>'.((strlen($update->content) > 50) ? substr($update->content).'...' : $update->content).'</td>';
		$res .= '</tr>';
		echo $res;
	} ?>
</table>
<?php endif; ?>
<br />
<a href="#" id="details-update" class="nav">Editer</a>
<a href="updates.php?operation=add&sid=<?php echo $supportcase->supportcaseId; ?>" id="add" class="nav">Nouveau</a>
<a href="#" id="delete-update" class="nav">Supprimer</a>

<a href="#" class="selectall">Tout cocher</a>
<a href="#" class="selectnone">Tout décocher</a>